#include<iostream>
using namespace std;
int main()
{
	long long sum = 0;
	int n;
	while (cin >> n)
	{
		sum=0;
		if (n == 0)
			break;
		for (int i = 0; i < n; i++)
		{
			int a;
			cin >> a;
			sum += a;
		}
		cout << sum << endl;
	}
	return 0;
}